home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
s-gikan2.maizuru-ct.ac.jp
/
s-gikan2.maizuru-ct.ac.jp.zip
/
s-gikan2.maizuru-ct.ac.jp
/
pub
/
old
/
ncvc351d_install.exe
/
{app}
/
scripts
/
remove_point.pl
< prev
next >
Wrap
Perl Script
|
2004-04-02
|
1KB
|
44 lines
#! /usr/bin/perl
# É▌ÆΦé╡é╜ò╢ÄÜâRü[âhé╠ăé╠ÉöÄÜé╠żÉöô_é≡ìφÅ£é╖éΘâXâNâèâvâg #
# ex P1000. -> P1000 #
# é╜é╛é╡üAżÉöÆlé╠éáéΘéαé╠(ex.41.1)é═ìφÅ£é╡é╚éó #
# żÉöÆlé¬0é╠é▌é╠é╞é½(ex.1.000)é═âIâvâVâçâôé┼É▌ÆΦ #
######################################################
#żÉöô_é≡ìφÅ£é╡é╜éóò╢ÄÜâRü[âhé≡ÿAæ▒é┼ôⁿéΩé─é¡é╛é│éó
#ex. SFP
$remove_code= 'SFP';
######################################################
###############################################################
#żÉöÆlé¬0é╠é▌é╠é╞é½Å¼Éöô_é≡ìφÅ£(ex.1.000->1) --> 0
# ìφÅ£é╡é╚éó(ex.1.000->1.000) --> 1
$point_flag= 0;
###############################################################
$pre_file= $ARGV[0];
$out_file= $ARGV[1];
open(IN,$pre_file);
open(OUT,">$out_file");
while(<IN>){
if(!/^N?[0-9\s]*[\(\%]/){
$new_line= "";
while(/([$remove_code])([\-\d\.]+)/){
($pre_line,$char,$num,$_)= ($`,$1,$2,$');
if($num =~ /(.+)\.$/){$num= $1;}
else{
if($point_flag == 0){
if($num =~ /(.+)\.0+$/){$num= $1;}
}
}
$new_line= $new_line.$pre_line.$char.$num;
}
$_= $new_line.$_;
}
print OUT;
}
close(OUT);
close(IN);